<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>字典目录管理</title>
    <#include "/common/link.ftl">

</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">

    <#assign currentMenu="systemDictionary"/>

    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>字典目录管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/systemDictionary/list" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">

                    <a href="#" class="btn btn-success btn-input" style="margin: 10px">
                        <span class="glyphicon glyphicon-plus"></span> 添加
                    </a>

                </form>
                <!--编写内容-->
                <div class="box-body table-responsive">
                    <table class="table table-hover table-bordered table-striped">
                        <thead>
                            <tr>
                                <th>编号</th>
                                <th>字典目录标题</th>
                                <th>字典目录编码</th>
                                <th>字典目录简介</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                        <#list pageInfo.list as sd>
                            <tr>
                                <td>${sd.id}</td>
                                <td>${sd.title}</td>
                                <td>${sd.sn}</td>
                                <td>${sd.intro}</td>
                                <td>
                                    <a href="#" class="btn btn-info btn-xs btn-input" data-json='${sd}'>
                                        <span class="glyphicon glyphicon-pencil" ></span> 编辑
                                    </a>
                                </td>
                            </tr>
                        </#list>
                        </tbody>
                    </table>
                    <#include "/common/page.ftl" >
                </div>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl" >
</div>


<#--模态框-->
<form class="form-horizontal" action="/systemDictionary/saveOrUpdate" method="post">

    <div id="eidtModel" class="modal fade" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">编辑/新增</h4>
                </div>
                <div class="modal-body">
                    <#--                表单-->
                    <div class="form-group">
                        <#--                        id的隐藏-->
                        <input type="hidden" name="id" >

                        <label for="inputEmail3"  class="col-sm-2 control-label">目录标题</label>
                        <div class="col-sm-10">
                            <input type="text" name="title"  class="form-control" id="title" placeholder="请输入目录标题">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword3" class="col-sm-2 control-label">目录编码</label>
                        <div class="col-sm-10">
                            <input type="text" name="sn" class="form-control" id="sn" placeholder="请输入目录编码">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="inputPassword3" class="col-sm-2 control-label">目录简介</label>
                        <div class="col-sm-10">
                            <input type="text" name="intro" class="form-control" id="intro" placeholder="请输入目录简介">
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary">保存</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</form>

</body>
<script>
    $('.btn-input').click(function () {

        var data = $(this).data('json');
        $('#eidtModel input').val("");
        console.log(data);
        if (data){
            $('input[name=id]').val(data.id);
            $('input[name=title]').val(data.title);
            $('input[name=sn]').val(data.sn);
            $('input[name=intro]').val(data.intro);
        }
         $('#eidtModel').modal("show");

    })


</script>


</html>
